/*!
 * \file nuMacApplication.h
 * \brief Application class for Mac.
 * \author Nus
 * \date 2008/03/09, 21:15
 */
 
#ifndef __NUMACAPPLICATION_H__
#define __NUMACAPPLICATION_H__

#include "nuApplication.h"
#include "nuMacEvent.h"

/*!
 * \class nuMacApplication
 * \brief Mac application class.
 * Derived from nuApplication for Mac platform only. Application for other
 * platform must choose the appropriate application class for it and derive
 * from that class instead.
 */
class nuMacApplication : public nuApplication
{
  BEGIN_RTTI_DECL(nuMacApplication);
    RTTI_DECL(nuMacApplication, nuApplication);
  END_RTTI_DECL(nuMacApplication);

public:
  //! \brief Default constructor.
  nuMacApplication();
  
  //! \brief Default destructor.
  virtual ~nuMacApplication();

  //! \brief Initialize application.
  virtual s32 initApp(void);

  //! \brief Run application.
  virtual s32 runApp(void);

  //! \brief Terminate application.
  virtual s32 termApp(void);
  
  //! \brief Resize.
  virtual void procResize(const nuRect& rect);
  
  //! \brief Process key input.
  virtual void procInput(s32 state, s32 key);
  
  //! \brief Process pointing devices.
  virtual void procPointingDev(s32 state, const nuPoint& point);

  //! \brief Window reference.
  static WindowRef getWindowRef(void) {
    return mWindowRef;
  }
  
  //! \brief Get Mac event.
  nuMacEvent& getMacEvent(void) {
    return mMacEvent;
  }
  
  //! \brief Get OS status.
  OSStatus getOsStatus(void) const {
    return mOsStatus;
  }

protected:
  static WindowRef mWindowRef;    //!< Window reference.
  nuMacEvent mMacEvent;       //!< Mac events.
  OSStatus mOsStatus;             //!< OS status.
  EventHandlerUPP mWindowEventHandlerUPP; //!< Window event handler UPP.

  //! \brief Initializing procedure.
  virtual s32 initProc(void);

  //! \brief Main procedure.
  virtual s32 mainProc(void);

  //! \brief Terminating procedure.
  virtual s32 termProc(void);

private:
  // None...

};

#endif
